#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "mybutton.h"
#include <QMainWindow>
#include "qpainter.h"
#include "qqueue.h"
#include "qslider.h"
#include "qlineedit.h"
#include "ui_mainwindow.h"
#include "searchbutton.h"
namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    bool isFirst;
    int total = 0;
    QPoint init_p;
    MyButton* buttonRoot;
    QSlider* slider;
    QLineEdit *lineEdit;
    static int AniSpeed;
    QQueue<QPoint> queue;
    QPoint Calculate(QPoint,QPoint);
    bool aniIsplay = false;
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void drawLine(MyButton*);
    void workThrourh(MyButton*);
    void UpdateRoot();
    void SearchData(MyButton*,int);
    void TraveseTreeNode(MyButton*,int);
private:
    Ui::MainWindow *ui;
    void AddNewNode(MyButton*,int);
protected:
    virtual void resizeEvent(QResizeEvent* a);
    void paintEvent(QPaintEvent*);
    void Search(QQueue<QPoint>*);
    QPainter* painter = new QPainter;
private slots:
        void on_pushButton_clicked();
        void setLineEditValue(int);
        void on_pushButton_2_clicked();

        void on_pushButton_3_clicked();
        void on_pushButton_4_clicked();
        void on_pushButton_5_clicked();
        void Search_Next();
};

#endif // MAINWINDOW_H
